let path  = require("path");
let HtmlWebpackPlugin = require("html-webpack-plugin");
let HtmlPlugin = new HtmlWebpackPlugin({
    // 默认 /访问的是index.html
    filename:"index.html",
    template:"./public/index.html"
})

module.exports = {
    mode:"development",
    entry:'./src/index.js',
    output:{
        filename:"build.js",
        path:path.resolve(__dirname,"build")
    },
    module:{
        rules:[
            {
                test:/\.css$/i,
                use:["style-loader",'css-loader']
            }
        ]
    },
    plugins:[HtmlPlugin],
    // 配置开发服务
    devServer:{
        // 设置服务端口号
        port:3000,
        // 设置服务启动后自动打开
        open:true
    }
}